import java.util.Scanner;
import java.lang.Math;

public class Trunk extends Vehicle
{
    private String vehicleid;
    private String brand;
    private String type;
    private float perRent;
    private double Ton;
    @Override
    public float calRent(int day)
    {
        float m;
        if(day<3) m= day*super.getPerRent();
        else if(day<7) m= (float) (0.9*day*getPerRent());
        else if(day<30) m = (float) (0.8*day*getPerRent());
        else if(day<150) m = (float) (0.7*day*getPerRent());
        else m = (float) (0.6*day*getPerRent());
        User.pay=m;
        return m;
    }
    @Override
    public boolean leaseOutFlow()
    {
        System.out.println("请选择你要租赁的货车类型：1广田 2.东风");
        Scanner in = new Scanner(System.in);
        int choice=in.nextInt();
        if(choice==1)
        {
            System.out.println("请选择你要租赁的货车的载重量：");
            int num=in.nextInt();
            String type=num+"kg";
            System.out.println("请输入您想要租赁的天数");
            int day=in.nextInt();
            String id="京NY";
            id+=(int)(10000+89999*Math.random());
            setVehicleid(id);
            setBrand("广田");
            setType(type);
            setPerRent(1500);
            System.out.println("分配给您的汽车车牌号是："+getVehicleid());
            System.out.println("您需要支付的租赁费用是："+calRent(day));
            int c = in.nextInt();
            if(c==1)
            {
                System.out.println("支付成功");
                return true;
            }
            else
            {
                System.out.println("支付失败");
                return false;
            }
        }
        else
        {
            System.out.println("请选择你要租赁的货车的载重量：");
            int num=in.nextInt();
            String type=num+"kg";
            System.out.println("请输入您想要租赁的天数");
            int day=in.nextInt();
            String id="京NY";
            id+=(int)(10000+89999*Math.random());
            setVehicleid(id);
            setBrand("东风");
            setType(type);
            setPerRent(2000);
            System.out.println("分配给您的汽车车牌号是："+getVehicleid());
            System.out.println("您需要支付的租赁费用是："+calRent(day));
            int c = in.nextInt();
            if(c==1)
            {
                System.out.println("支付成功");
                return true;
            }
            else
            {
                System.out.println("支付失败");
                return false;
            }
        }
    }
}
